Type Inference for Java 5 Wildcards, F-Bounds, and Undecidability
نویسندگان
چکیده
We consider the problem of type checking for Java 5 with generics and wildcard types. Java supports type inference for methods with type parameters, but its presentation in the Java Language Specification lacks both clarity and a sense for how inference fits into the larger picture of Java’s type system. We show, in contrast, how this type inference can be cleanly integrated with subtyping of wildcard types, justifying the intuitions of programmers and logicians alike. In addition, we examine the decidability of Java typechecking and identify key points in the subtyping relation that both lead to undecidability and suggest a decidable conservative approximation.
منابع مشابه
Programme Chair Programme Committee External Reviewers Session 2. Languages and Verification Session 3. Analysis towards an Existential Types Model for Java Wildcards
Wildcards extend Java generics by softening the mismatch between subtype and parametric polymorphism. Although they are a key part of the Java 5.0 programming language, a type system including wildcards has never been proven type sound. Wildcards have previously been formalised as existential types. In this paper we extend FGJ, a featherweight formalisation of Java with generics, with existenti...
متن کاملTowards an Existential Types Model for Java Wildcards
Wildcards extend Java generics by softening the mismatch between subtype and parametric polymorphism. Although they are a key part of the Java 5.0 programming language, a type system including wildcards has never been proven type sound. Wildcards have previously been formalised as existential types. In this paper we extend FGJ, a featherweight formalisation of Java with generics, with existenti...
متن کاملA Model for Java with Wildcards
Wildcards are a complex and subtle part of the Java type system, present since version 5.0. Although there have been various formalisations and partial type soundness results concerning wildcards, to the best of our knowledge, no system that includes all the key aspects of Java wildcards has been proven type sound. This paper establishes that Java wildcards are type sound. We describe a new for...
متن کاملJava Type Unification with Wildcards
With the introduction of Java 5.0 the type system has been extended by parameterized types, type variables, type terms, and wildcards. As a result very complex types can arise. The term Vector>> is for example a correct type in Java 5.0. In this paper we present a type unification algorithm for Java 5.0 type terms. The algorithm unifies type terms, which a...
متن کاملThe Undecidability of Type Related Problems in Type-free Style System F
We consider here a number of variations on the System F, that are predicative second-order systems whose terms are intermediate between the Curry style and Church style. The terms here contain the information on where the universal quantifier elimination and introduction in the type inference process must take place, which is similar to Church forms. However, they omit the information on which ...
متن کامل